package com.wx.plugin.repository;


import com.yangzcp.userpojo.Members_account;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.math.BigDecimal;

public interface Members_accountRepository extends JpaRepository<Members_account, Integer>{
    @Query("from Members_account where ref_member.id=?1")
    Members_account findByMemberId(Integer id);

    @Query("update Members_account set money=money-?1, gain_money=gain_money-?1, version=version+1, update_time=?2 where ref_member.id=?3 and version=?4")
    @Modifying
    int jianAccount(Long money, Long gainmoney, Long updateTime, Integer memberid, Integer version);
}
